<%-- 
    Document   : newjsp
    Created on : 14.12.2013, 17:58:26
    Author     : admin-pc
--%>
<!DOCTYPE html>
<%@page import="EJB.ChatEJB"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.util.*"%>
<%
    String username = request.getParameter("username");

    if (username == null) {
        username = "";
    }

    Date now = new Date();
    String timestamp = now.toString();
    Cookie cookie = new Cookie("username", username);
    cookie.setMaxAge(365 * 24 * 60 * 60);
    response.addCookie(cookie);
    String cookieString = cookie.getValue();
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <jsp:useBean id="chat" scope="session" class="EJB.ChatEJB" />
        <jsp:setProperty name="chat" property="name" value="<%=username%>" />
        <jsp:getProperty name="chat" property="name" />
        <form method="post" action="chatpage.jsp">
            <input type="submit" name="subm">
        </form>
    </body>
</html>